<?php
//信息分类控制器
namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Org\Upload;


class ShangchuanController extends CommonController
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
		
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
		
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
		$upfile = new Upload("myfile");
	
		//初始化上传信息
		$upfile->path="./img/home/"; //上传储存路径
		$upfile->typeList =array("image/jpeg","image/png","image/gif"); //设置允许上传类型
		$upfile->maxSize =0; //允许上传大小
	
		//执行文件上传
		$res = $upfile->doUpload();
	
		//判断输出
		if($res){
			
			//执行数据库添加，即原数据进行修改
			$src = $upfile->saveName;
			$id = $_POST['id'];
			
			\DB::table('classone')->where('id',$id)->update(['pic' => $src]);
			dd($src);
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
       
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
		
    }
}
